<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>symbol,graphic</title>
<link rel="stylesheet" type="text/css"
	href="http://localhost:8080/testA/arcgisjs/js/dojo/dijit/themes/tundra/tundra.css" />
<script type="text/javascript">
var path = location.pathname;
//alert(path)
path =  path.slice(0, path.lastIndexOf("/") + 1);
var dojoConfig = {
	packages : [{ name:'widgets', location : path + ""}]	
}
</script>	
	
<script type="text/javascript"
	src="http://localhost:8080/testA/arcgisjs/init.js"></script>
<link rel="stylesheet" type="text/css"
	href="http://localhost:8080/testA/arcgisjs/js/esri/css/esri.css" />
</head>
<script type="text/javascript">

    
	require(
			[       'esri/map', 'esri/geometry/Extent',  
					'esri/layers/ArcGISTiledMapServiceLayer', "dojo/parser",'esri/geometry/Point',
					 "esri/layers/GraphicsLayer","esri/layers/ArcGISDynamicMapServiceLayer", "dojo/on",
					 "esri/graphic","esri/symbols/Symbol","esri/symbols/SimpleMarkerSymbol",
					 "esri/symbols/SimpleLineSymbol","esri/symbols/SimpleFillSymbol", "esri/Color",
					"esri/geometry/Circle","widgets/MeasureLength","dojo/domReady!"
					 ],
			function(map1, Extent, 
					ArcGISTiledMapServiceLayer,parser, Point, 
					GraphicsLayer, ArcGISDynamicMapServiceLayer,on,
					Graphic,Symbol,SimpleMarkerSymbol,
					SimpleLineSymbol,SimpleFillSymbol,Color,
					Circle,MeasureLength
					) {
				parser.parse();
				var url = "http://cache1.arcgisonline.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer";

				var initialExtent = new esri.geometry.Extent({
					"xmin" : 6971056.979606233,
					"xmax" : 16363639.015286192,
					"ymin" : 1932328.0750486827,
					"ymax" : 7152059.8625854105,
					"spatialReference" : {
						"wkid" : 102100
					}
				});

				var myMap = new map1('arcgisDiv', {
					//center : [-98, 40] , 不能与extent同时存在
					extent : initialExtent
				});


	            
				//var wmtsLayer = new WMTSLayer("http://v2.suite.opengeo.org/geoserver/gwc/service/wmts", options);
				var myTiledMapServiceLayer = new ArcGISTiledMapServiceLayer(url);
				myMap.addLayer(myTiledMapServiceLayer);
 				var graphicsLayer = new GraphicsLayer({id:'other'})
 				myMap.addLayer(graphicsLayer);
 				//dojo.connect(myMap,'onClick', clickMap);
 				function clickMap(){
 					alert(1); 
 					MeasureLength.action
 				}
 				
 				var  cc = dojo.byId('test2');
 				//dojo.connect(dojo.byId('test2'),'onclick', clickMap2);
 				
 				// dojo.byId('test2').on('onclick',clickMap2)
 				 
 				 dojo.connect(dojo.byId('test2'),'click', clickMap2);
 				//dojo.connect(dojo.byId('test2'),'Click', clickMap2);
 				 
 				function clickMap2(){
 					alert(2);
 					MeasureLength.action(myMap);
 				}
 
			})
</script>
<body class="tundra">
	<div id="arcgisDiv"
		style="width: 900px; height: 600px; border: 1px solid #000;"></div>
	<button id="test2">测距按钮</button>
</body>
</html>